const path = require('path');
const { CleanWebpackPlugin } = require("clean-webpack-plugin")

module.exports = {
    entry:path.resolve(__dirname,'./src/main.ts'),
    output:{
        path:path.resolve(__dirname,'./dist'),
        filename:'bundle.[contenthash:8].js'
    },
    resolve:{
        extensions: ['.ts', '.js',]
    },
    module:{
        rules:[
            {
                test:/.ts$/,
                use:'awesome-typescript-loader',
                exclude:/node_modules/
            },
            {
                test:/.(c|sc)ss$/,
                use:['style-loader','css-loader','sass-loader'],
                exclude:/node_modules/
            }
        ]
    },
    plugins:[
        new CleanWebpackPlugin()
    ],
    devtool:'source-map', //输出 Source Map 方便在浏览器里调试 TypeScript 代码
    // mode:'production'
}